<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="app" uri="http://www.wanrenhui.com" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
	  <%@include file="/res/include/base-head.jsp"%>
	  <%@include file="/res/include/jquery-easyui.jsp"%>
	<script type="text/javascript" src="${pageContext.request.contextPath}/res/js/community/communityMessage.js"></script>
  </head>
  <body>
	<div class="easyui-layout" data-options="fit:true">
		<div data-options="region:'north',border:false,split:false">
	    	<form id="query-form" class="search_form clearfix">
				<dl>
					<dt>是否置顶：</dt>
					<dd>
						<select name="isTop" id="isTop" class="txt grid-8">
							<option value="">请选择</option>
							<option value="1">已置顶</option>
							<option value="2">未置顶</option>
						</select>
					</dd>
				</dl>
				<dl>
					<dt>是否官方：</dt>
					<dd>
						<select name="isOfficial" id="isOfficial" class="txt grid-8">
							<option value="">请选择</option>
							<option value="1">官方</option>
							<option value="2">非官方</option>
						</select>
					</dd>
				</dl>
				<dl>
	            	<dt>创建时间：从</dt>
	                <dd>
		                <input name="startAtStr" id="startAtStr" type="text" class="txt easyui-datetimebox" maxlength="19"/> 到 
		                <input name="endAtStr" id="endAtStr" type="text" class="txt easyui-datetimebox" maxlength="19"/>
	                </dd>
	            </dl>
	            <p class="search_form_btn">
	            	<input type="button" value="搜索" class="icon_serach" onclick="admin.communityMessage.query()" />
	            </p>
	        </form>
	  	</div>
	    <div data-options="region:'center',border:false">
		    <table id="datagrid" data-options="url:'${pageContext.request.contextPath}/community/message/list',toolbar:'#toolbar'">
				<thead>
					<tr>
						<th data-options="field:'communityName',width:120,align:'center' ">社区</th>
						<th data-options="field:'content',width:300,align:'left' ">内容</th>
						<th data-options="field:'userNick',width:100,align:'center' ">发布人</th>
						<th data-options="field:'strNewAt',width:120,align:'center' ">发布时间</th>
						<th data-options="field:'status',width:80,align:'center',formatter:formatStatus">状态</th>
						<th data-options="field:'isShow',width:80,align:'center',formatter:formatShow">是否显示</th>
						<th data-options="field:'isTop',width:80,align:'center',formatter:formatIsTop">置顶</th>
						<th data-options="field:'isOfficial',width:80,align:'center',formatter:formatIsOfficial ">是否官方</th>
						<th data-options="field:'pv',width:80,align:'center'">浏览量</th>
			            <th data-options="field:'id',align:'left',width:200,formatter:formatOperation">管理操作</th>
					</tr>
				</thead>
			</table>
	  	</div>
	</div>
	<script>
		function formatOperation(value,row,index) {
			var isTop = row.isTop;
			var l_html = '';
			if(row.status=="1"){
				l_html += '<a href="javascript:;" class="table_link" onclick="admin.communityMessage.unclaimed('+row.id+')">删除</a>';
			}else if(row.status=="2"){
				l_html += '<a href="javascript:;" class="table_link" onclick="admin.communityMessage.receive('+row.id+')">取消删除</a>';
			}
			if(isTop == "1"){
				l_html += '|<a href="javascript:;" class="table_link" onclick="admin.communityMessage.undoTop('+row.id+')">取消置顶</a>';
			}else{
				l_html += '|<a href="javascript:;" class="table_link" onclick="admin.communityMessage.doTop('+row.id+')">置顶</a>';
			}
			if(row.isOfficial=="1"){
				l_html += '|<a href="javascript:;" class="table_link" onclick="admin.communityMessage.countermand('+row.id+')">取消官方</a>';
			}
			return l_html;
		}
		function formatStatus(value,row,index) {
			var status = row.status;//状态CommunityMessageStatusEnum:1-正常;2-删除'
			if(status=="1"){
				return '正常';
			}else if(status=="2"){
				return '删除';
			}
		}
		
		function formatShow(value,row,index) {
			var isShow = row.isShow;//是否显示:1-是;2-否
			if (isShow=="1") {
				return '是';
			} else if (isShow=="2") {
				return '否';
			} 
		}
		
		/**已不再使用**/
		function formatType(type) {
			var l_html = '';//类型CommunityMessageTypeEnum:1-互助;2-八卦;3-活动;4-社区;5-娱乐;6-财经;7-数码
			if(type==1){
				l_html="互助";
			} else if(type==2){
				l_html="八卦";
			} else if(type==3){
				l_html="活动";
			} else if(type==4){
				l_html="社区";
			} else if(type==5){
				l_html="娱乐";
			} else if(type==6){
				l_html="财经";
			} else if(type==7){
				l_html="数码";
			}
			return l_html;
		}
		
		function formatImg(img){
	        return '<img style="width:120px;height:120px;" src="http://file.xfquanquan.com'+img+'"/>'
	    }
		function formatIsTop(value,row,index){
			var l_html = '';
			var isTop=row.isTop;
			if(isTop==1){
				l_html+='已置顶';
			}else{
				l_html+='';
			}
			return l_html;
		}
		function formatIsOfficial(value,row,index) {
			var l_html = '';
			if (value==1) {
				l_html = '官方';
			}else{
				l_html = '';
			}
			return l_html;
		}
	</script>
  </body>
</html>
